<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>取得或设置 apache 请求记录</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.apache-note" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">apache_note</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">apache_note</span> &mdash; <span class="dc-title">取得或设置 apache 请求记录</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.apache-note-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
    <span class="methodname"><strong>apache_note</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$note_name</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$note_value</code><span class="initializer"> = &quot;&quot;</span></span>
  ] ) : <span class="type">string</span></div>

    <p class="para rdfs-comment">
   这个函数是 Apache  <em>table_get</em> 和
   <em>table_set</em> 的包装。 
     它编辑了请求中存在的 notes 表。
     这个表的目的是允许 Apache 模块进行通讯。
  </p>
  <p class="para">
   <span class="function"><strong>apache_note()</strong></span> 的主要用途是在同一个请求中，从一个模块传递信息到另一个模块。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.apache-note-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">note_name</code></dt>

     <dd>

      <p class="para">
       note 名。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">note_value</code></dt>

     <dd>

      <p class="para">
       note 值。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.apache-note-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   如果只有一个参数调用，则返回记录
   <em>note_name</em> 的当前值。如果用两个参数调用，则将记录
   <em>note_name</em> 的值设为
   <em>note_value</em> 并返回记录
    <em>note_name</em> 的前一个值。如果未能获取记录，则返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.apache-note-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5818">
    <p><strong>Example #1 Passing information between PHP and Perl</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />apache_note</span><span style="color: #007700">(</span><span style="color: #DD0000">'name'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'Fredrik&nbsp;Ekengren'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Call&nbsp;perl&nbsp;script<br /></span><span style="color: #0000BB">virtual</span><span style="color: #007700">(</span><span style="color: #DD0000">"/perl/some_script.pl"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">apache_note</span><span style="color: #007700">(</span><span style="color: #DD0000">"resultdata"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents">
<div class="perlcode"><pre class="perlcode"># Get Apache request object
my $r = Apache-&gt;request()-&gt;main();

# Get passed data
my $name = $r-&gt;notes(&#039;name&#039;);

# some processing

# Pass result back to PHP
$r-&gt;notes(&#039;resultdata&#039;, $result);</pre>
</div>
    </div>

   </div>
  </p>
  <p class="para">
   <div class="example" id="example-5819">
    <p><strong>Example #2 Logging values in access.log</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />apache_note</span><span style="color: #007700">(</span><span style="color: #DD0000">'sessionID'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">session_id</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents">
<div class="apachecode"><pre class="apachecode"># &quot;%{sessionID}n&quot; can be used in the LogFormat directive</pre>
</div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.apache-note-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="virtual.html" class="function" rel="rdfs-seeAlso">virtual()</a> - 执行 Apache 子请求</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>